
# Constructing Figure 1 by combining results of New Zealand and Sweden

source("ObsStudy_01_01_NZ.R")
source("ObsStudy_01_02_Sweden_2018.R")


if(!robustnesscheck_pid){
  
names(m2_s$coefficients)[names(m2_s$coefficients) == "M_M"] <- "Government Lottery Mean"
names(m6_s$coefficients)[names(m6_s$coefficients) == "M_SAP"] <- "Government Lottery Mean"
names(m2_nz$coefficients)[names(m2_nz$coefficients) == "lottery_mean"] <- "Government Lottery Mean"

names(m2_s$coefficients)[names(m2_s$coefficients) == "V_M"] <- "Government Lottery Variance"
names(m6_s$coefficients)[names(m6_s$coefficients) == "V_SAP"] <- "Government Lottery Variance"
names(m2_nz$coefficients)[names(m2_nz$coefficients) == "lottery_variance"] <- "Government Lottery Variance"

# Create a stargazer table including only the selected variables
stargazer(m2_s, m6_s, m2_nz, 
          align = TRUE, 
          keep = c("Government Lottery Variance","Government Lottery Mean"),
          dep.var.labels = c("Moderates (Sweden 2018)", "SAP (Sweden 2018)", "Labour (NZ 2020)"),
          out = "Table1.tex",type = "latex"
)


stargazer(m2_s, m6_s, m2_nz, 
          align = TRUE, 
          omit = c("sex", "edu", "age", "age_sqrt"),
          covariate.labels = c("Government Lottery Mean", "Government Lottery Variance", "Rating Party Moderates", "Government Lottery Mean", "Government Lottery Variance", "Rating Party SAP", "Government Lottery Mean", "Government Lottery Variance", "Rating Party NZ"),
          dep.var.labels = c("Moderates (Sweden 2018)", "SAP (Sweden 2018)", "Labour (NZ 2020)"),
          out = "TableSM16.tex",type = "latex"
          )
}